/*
 * Copyright (C) Francisco Morero Peyrona. All rights reserved.
 *
 * This software is published under the terms of Open Source 
 * License version 1.1, a copy of which has been included with this
 * distribution in the License.txt file.  
 */

package jdbcmanager.tree;

import jdbcmanager.app.*;
import jdbcmanager.dbtools.DbUtil;
import jdbcmanager.dbtools.datatypes.*;

/**
 * This class is a node that contains following child nodes: <br>
 * <ul>
 * <li>NodeTable
 * <li>NodePorcedure
 * <li>NodeDiagram
 * </ul>
 * 
 * @author Francisco Morero Peyrona
 */

final class NodeSchema extends JdbcTreeNode
{
    NodeSchema( String sCatalog, String sCaption )
    {
        super( icon_tree_schema, new DbEntityDescriptor( sCatalog, sCaption, sCaption ) );

        // Set Invalid Actions
        setOpenable( false );
    }

    // This class is always initialised, because when Schemas are created,
    // Tables, Procedures and Diagrams node branches are automatically added to Schema node.
    boolean isInitialised()
    {
        return true;
    }

    // NEXT: hacerlo
    boolean new_()
    {
        App.showMessage( "Option not yet implemented" );
        return false;
    }

    void open()
    {
        // Redefined because was declared abstract in parent, but nothing to do
    }

    // NEXT: hacerlo
    boolean edit()
    {
        App.showMessage( "Option not yet implemented" );
        return false;
    }

    // this.frame is always null because there is no frame associated with catalogs
    // NEXT: hacerlo
    boolean rename( String sNewName )
    {
        App.showMessage( "Option not yet implemented" );
        return false;
    }

    // this.frame is always null because there is no frame associated with catalogs
    // NEXT: hacerlo
    boolean delete()
    {
        App.showMessage( "Option not yet implemented" );
        return false;
    }

    void info()
    {
    	  String sCatalog = DbUtil.getAgentDBMS().getAgentMetaData().getCatalogTerm();
        String sSchema  = DbUtil.getAgentDBMS().getAgentMetaData().getSchemaTerm();

        App.showMessage( sSchema+ " Information",
                         "This RDBMS supports \""+ sSchema +"s\": a way to structure "+ sCatalog +"s.\n"+
                         "Selected "+ sSchema +" is: '"+ ded.getName() +'\'' );
    }
}